<template>
  <el-form-item v-if="!domains.length" label="领域">
    <span style="color: red;font-style: italic;font-weight: bold;margin: auto;font-size: 16px">未选择作者领域</span>
  </el-form-item>
  <el-form-item label="领域" :key="i" v-for="(domain,i) in domains">
    {{ domain }}
    <el-button @click="delAuthorDomain(i)" style="margin-left: auto">删除领域</el-button>
  </el-form-item>
</template>

<script setup>
import {defineModel} from "vue";

const domains = defineModel()
const delAuthorDomain = (j) => {
  const len = domains.value.length
  if (0 <= j && j < len && confirm('确定要删除领域' + domains.value[j].name + '?')) {
    domains.value.splice(j, 1);
  }
}
</script>

<style scoped>

</style>